#!/bin/sh
# create_file
type=$1
name=$2
user=$3
if [ $user ] ; then
username="创建者${user}"
else
username="创建者shiroi"
fi
str="<?php"
time="创建于："$(date "+%Y-%m-%d %H:%M:%S")

if [ $type = "controller" ] ; then
	suffix=".php"
	all=${str}"\n//Created Controller Success\n//${username}\n//${time}"
elif [ $type = "model" ] ; then
	suffix=".php"
	all=${str}"\n//Created Model Success\n//${username}\n//${time}"
elif [ $type = "html" ] ; then
	suffix=".html"
	all="<!-- Created Html Success\n${username}\n${time}\n -->"
else
	suffix=".txt"
	all="This is txt file\r\n${username}\r\n${time}"
fi
if [ $name ] ; then
	demo=${name}
else
	demo="demo"
fi
echo -e ${all} > ${demo}${suffix}